<template>
	<!-- 奖杯 -->
	<view class="">
		<image :src="infoCont.activity_img_6" style="width: 100%; height: 330rpx;" mode="aspectFill"></image>
		<view class="container cont">
			<view class="state font-sm text-center">{{ infoCont.status_name }}</view>
			<view class="bg-white mt-1 rounded shadow">
				<view class=" py-2 px-5">
					<view class="cup_num flex justify-around py-2">
						<view class="text-center">
							<b class="font">{{ infoCont.company_count }}</b>
							<view class="cup_num_tit font-sm text-white rounded">参评企业数</view>
						</view>
						<view class="text-center">
							<b class="font">{{ infoCont.vote_num }}</b>
							<view class="cup_num_tit font-sm text-white rounded">总票数</view>
						</view>
					</view>
				</view>
				<view class="cup_time text-white text-center font-sm p-1">投票时间：{{ infoCont.time }}</view>
			</view>
			<view class="mt-2">
				<t-table border="0" border-color="#163566">
					<t-tr>
						<block v-for="(child, idx) of tableList" :key="child.prize_id">
							<t-td @click="cupChange(idx, child.prize_id)">
								<view class="w-100 p-2 font-sm text-center" :class="tabCur == 1 && cur == idx ? 'active' : ''">{{ child.prize_title }}</view>
							</t-td>
						</block>
					</t-tr>
				</t-table>
			</view>
		</view>
	</view>
</template>

<script>
import tTable from '@/subPages/home/product_data/component/t-table/t-table.vue';
import tTh from '@/subPages/home/product_data/component/t-table/t-th.vue';
import tTr from '@/subPages/home/product_data/component/t-table/t-tr.vue';
import tTd from '@/subPages/home/product_data/component/t-table/t-td.vue';
import { voteActivityDetil } from '@/api/my/gnb_apply.js';
export default {
	components: { tTable, tTh, tTr, tTd },
	props: ['activityId', 'tabCur', 'tableList'],
	data() {
		return {
			cur: 0,
			infoCont: {}
		};
	},
	created() {
		this.info();
	},
	methods: {
		info() {
			// 活动详情
			voteActivityDetil({ activity_id: this.activityId }).then(res => {
				if (res.code == 0) {
					this.infoCont = res.data;
				} else {
					uni.$u.toast(re.msg);
				}
			});
		},
		cupChange(idx, val) {
			// console.log('==', idx, val);
			this.$emit('cupChange', val);
			this.cur = idx;
		}
	}
};
</script>

<style lang="scss" scoped>
.cont {
	margin-top: -65rpx;
}
.state {
	color: #ffe0a7;
}
.cup_num {
	border: 1px dashed #163566;
}
.cup_num_tit {
	background-color: #f1b15e;
	width: 150rpx;
	padding: 7rpx 0;
	margin-top: 3rpx;
}
.cup_time {
	background-color: #163566;
	border-radius: 0 0 10rpx 10rpx;
}
.active {
	background-color: #163566;
	color: #fff;
}
</style>
